<script>
	export default {
		onLaunch: function(options) {
			console.log('App Launch');
			//页面带share_token传参，保存在缓存
			if (options.query.share_token){
				uni.setStorageSync("share_token",options.query.share_token);
			}
			let platform = this.app.getPlatform();
			if (platform == "MP-WEIXIN" && options.query.scene) {
				let scene = options.query.scene;
				let share_token = scene.split("_")[0]; //字符分割
				uni.setStorageSync("share_token",share_token);
			}
			//获取全站默认配置
			this.$u.get('publics/api.index/defaultSetting',{
			}).then(res => {
				uni.setStorageSync("setting",res.data.setting);
				var session_id = uni.getStorageSync("session_id");
				if (session_id == ''){
					uni.setStorageSync("session_id",res.data.session_id);
				}
				let pages = getCurrentPages();
				let page = pages[pages.length - 1];
				if (typeof(page) != 'undefined' && page.route.indexOf('passport/login') < 0) {
					this.app.getWxOauthOpenId(this,options.query);//微信自动登陆，针对公众号访问和微信小程序有效
				}
			})
			//代理端每3秒验证登陆状态
			setInterval(() => {
				this.app.isLogin(this,'channel')},3000);
		},
		onShow: function() {
			console.log('App Show');
			let platform = this.app.getPlatform();
			// let result = wx.getLaunchOptionsSync();
			// console.log(result);
		},
		onHide: function() {
			console.log('App Hide');
		}
	}
</script>

<style lang="scss">
	@import "uview-ui/index.scss";
	@import './layout.scss';
	@import './static/public/css/public.scss';
	@import "./static/shop/diyPage/css/diy.scss";
	/*隐藏顶部导航，暂无法识别微信或其它浏览器访问，h5统一隐藏 */
	/* #ifdef H5 */
	uni-page-head{
		display: none;
	}
	.diy-fixedsearch{
		top:0 !important;
	}
	uni-page-head[uni-page-head-type=default]~uni-page-wrapper{
		height: 100%;
	}
	/* #endif */
</style>
